#define _WIN32_WINNT  0x0500
#define _WIN32_DCOM

#include <objbase.h>
#include "COM_WMI_Consumer.h"
#include <iostream>
#include "PHEventConsumer.h"
#include "..\..\phshared\phshared.h"

using namespace std;
CPHEventConsumer clConsumer;
CB inst;



bool Start(void (*Start)(long),void (*Stop)(long))
{
	inst._Start=Start;
	inst._Stop=Stop;
	HRESULT hres;

	/*Start the process detection*/
	if(!clConsumer.Connect())
		return false;
	if(!clConsumer.Setup())
		return false;
	return true;
}
void Stop()
{

	HRESULT hres;
	/*TODO: hres = clConsumer.m_pSvc->CancelAsyncCall(pStubSink);*/

    // Cleanup
    // ========
	if(clConsumer.m_pSvc)
		clConsumer.m_pSvc->Release();
	if(clConsumer.m_pStartSink)
		clConsumer.m_pStartSink->Release();
	if(clConsumer.m_pStopSink)
		clConsumer.m_pStopSink->Release();

    CoUninitialize();
}